import java.util.Random;

public class Role {
    private String name;
    private int blood;
    private String gender;
    private String faces;
    String[] boyfaces = {"气宇轩昂", "风流倜傥", "英俊潇洒"};
    String[] girlfaces = {"美轮美奂", "沉鱼落雁", "闭月羞花"};

    public Role() {
    }

    public Role( String name,int blood, String gender) {
        this.blood = blood;
        this.name = name;
        this.gender = gender;
        setFaces();
    }



    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getBlood() {
        return blood;
    }

    public void setBlood(int blood) {
        this.blood = blood;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getFaces() {

        return faces;
    }

    public void setFaces() {


        Random r=new Random();
        if(gender.equals("男"))
        {
            int index=r.nextInt(boyfaces.length);
            this.faces=boyfaces[index];
        }
        else if(gender.equals("女"))
        {
            int index=r.nextInt(girlfaces.length);
            this.faces=girlfaces[index];
        }
        else
        {
            this.faces=null;
        }


    }
    String[] attacks_desc={
            "%s使出了一招【背心钉】,转动对方的背后，一掌向%s背心的灵台穴拍去",
            "%s使出了一招【满空探爪】，飞起身自半空中边掌为抓锁向%s",
            "%s大喝一声，身形下伏，一招【雷劈坠地】，摔向%s双腿"
    };
    public void showRoleInfo()
    {
        System.out.println("姓名为："+name+","+"血量为："+blood+"性别为"+gender);
    }
    public void attack(Role role)
    {
        Random r=new Random();
        int hurt=r.nextInt(20);
        int index=r.nextInt(attacks_desc.length);
        String kungfu=attacks_desc[index];
        int remainblood=role.getBlood();
        remainblood=remainblood-hurt;
        remainblood=remainblood>0?remainblood:0;
        role.setBlood(remainblood);
        System.out.printf(kungfu,getName(),role.getName());
        System.out.println(role.getName()+"还剩下"+remainblood+"血量");
        System.out.println();


    }
    
}
